package com.hmall.common.client;


import com.hmall.common.dto.Item;
import com.hmall.common.dto.PageDTO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestParam;


@FeignClient("itemservice")
public interface AllClient {

    //分页
    @GetMapping("/item/list")
    PageDTO<Item> callClient(@RequestParam("page") Long page, @RequestParam("size") Long size);


    //根据id查询商品
    @GetMapping("/item/{id}")
    Item selectById(@PathVariable Long id);

    //扣减库存
    @PutMapping("/item/stock/{itemId}/{num}")
    void stock (@RequestParam("itemId")Long itemId,@RequestParam("num") Integer num);
}
